function DO = calcDO(calformID, DOreq, c)
  % Function used in moorings software to calculate dissolved oxygen
  %
  % Author: David Goldsmith, Wash. State Dept. of Ecology, dgol461@ecy.wa.gov
  % Release date: N/A
  
  % ToDo: check formula against email from Brandon dated 8/22/2011, subject "FW:"
  %
  % Added in response 12/13/2011
  %
  % Said formula is for DOS, which is implemented in the DB as a stored procedure, i.e., DOS here
  % results from a DB query, not a calculation within this software package.
  %
  % Furthermore, the formula referenced in the email is "Weiss-like," not "Garcia/Gordon-like,"
  % the latter being what we've been using, i.e., in the DB stored proced., and the two are
  % not directly comparable; thus assuring consistency with the former would require a complete
  % change in the way we've been computing DOS all along, something we are unprepared to do at this
  % writing.
  %
  % Finally, the formula below, as cited in the Sea-bird reference literature ("Application Note 64"),
  % is nominally for DOS, and therefore DO, in units of mL/L, whereas the DB has been storing DOS
  % in units of mg/L.  The latter, however, are the units we ultimately want for DO, and since the
  % unit conversion is a simple multiplier to DOS (and DOS occurs simply as a factor in the formula 
  % below), the formula below is equally valid to output DO in mg/L, as long as DOS is already in 
  % those units.  In other words, the absence of any modification to the DOS obtained from the DB
  % does not make the formula below incorrect, despite the apparent mismatch between its stated units
  % of validity and our DB's unit for DOS.
  %
    try
        if strcmpi(calformID, 'SBE')
            [P, T, V, DOS] = deal(DOreq{:});
            [Soc, Voffset, A, B, C, E]  = deal(c{:});
            DO = Soc * (V + Voffset) * DOS * ...
                      (1 + A*T + B*T*T + C*T*T*T) * ...
                      exp(E * P / (T + 273.15));
        else
            DO = 'Sorry, unrecognized DO CalibrationFormulaID.  ';
        end
    catch ME
        DO = 'Unhandled Error!';
    end
end